package com.bank.RabbitMQ;

import com.alibaba.fastjson.JSON;
import com.bank.entity.Member;
import com.bank.entity.vo.SeckillMessage;
import lombok.extern.slf4j.Slf4j;
import net.minidev.json.JSONArray;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: Lixy
 * @email: 1908598362@qq.com
 * @date: 2022/2/1 星期二 21:44
 */

@Service
@Slf4j
public class Producter {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void SendSecMsg(SeckillMessage msg){
        log.info("发送消息："+msg);
//        Member user = msg.getMember();
//        user.setCreateTime(null);
//        user.setPhone("");
//        user.setName("");
//        user.setPassword("");
//        user.setAge(new Long(0));
        String Jsonmessage = JSON.toJSONString(msg);
        rabbitTemplate.convertAndSend("SeckillExchange","seckill.message",Jsonmessage);
    }

}
